package cn.lcsjsxy.yxc.objectoriented.接口.代理模式;

public class NerWorkTest1 {
    public static void main(String[] args) {
        Self self=new Self();
        Handler handler=new Handler(self);  //com.yang_xc.objectoriented.多态性

        //使用代理类来调取方法，不直接暴露被代理类
        handler.collectMoney();
        handler.sing();
        handler.concludeAContract();
    }
}

interface star{

    /**
     * 签合同
     */
    public void concludeAContract();

    /**
     * 唱歌
     */
    public void sing();

    /**
     * 收钱
     */
    public void collectMoney();

}

class Self implements star{
    @Override
    public void collectMoney() {

    }

    @Override
    public void sing() {
        System.out.println("明星唱歌");
    }

    @Override
    public void concludeAContract() {

    }
}

class Handler implements star{
    private Self self;

    public Handler(Self self) {
        this.self = self;
    }

    @Override
    public void concludeAContract() {
        System.out.println("经理人签合同");
    }

    @Override
    public void sing() {
        self.sing();
    }

    public void collectMoney(){
        System.out.println("经理人收钱");
    }
}


